import request from "@/utils/request";

// 查询候选人
export function getCandidates(params) {
    return request({
        url: "/InterviewCandidate/getList",
        method: "get",
        params,
    });
}

// 新增候选人
export function addCandidate(data) {
    return request({
        url: "/InterviewCandidate/addCandidate",
        method: "post",
        data,
    });
}

// 更新候选人
export function updateCandidate(id, data) {
    return request({
        url: `/InterviewCandidate/${id}`,
        method: "put",
        data,
    });
}

// 删除候选人
export function deleteCandidate(id) {
    return request({
        url: `/InterviewCandidate/${id}`,
        method: "delete",
    });
}

// 上传简历
export function uploadResume(data) {
    return request({
        url: "/InterviewCandidate/uploadOss",
        method: "post",
        data,
        headers: {
            "Content-Type": "multipart/form-data",
        },
    });
}

// 预览简历
export function previewResume(path) {
    return request({
        url: '/InterviewCandidate/previewResume',
        method: 'get',
        params: { path }
    });
}

// 下载简历
export function downloadResume(path) {
    return request({
        url: '/InterviewCandidate/downloadResume',
        method: 'get',
        params: { path }
    });
}